<?php
 $arr = array();
 $stt=0;
 foreach($this->datas as $row)
 {
    $arr[intval($stt/3)][] = $row;
    $stt++;
 }
 ?>
 <div class="block">
        <h4 class="vatlytrilieu"><a href="<?=$this->baseUrl("/")?>">Home</a> &gt; <?=stripslashes($this->cat->article_name)?></h4>
        <div class="block_content">   
             <?php $stt=1;foreach($arr as $wrap){ ?>
             <div class="contentWrapLeft"> 
                <?php foreach($wrap as $row){ ?>
                <div class="productWrap1">                    
                    <a title="<?=$row->name?>" class="fancybox" href="<?=$this->baseUrl("images/product/$row->image")?>">                                   
                    <?php if(!empty($row->thumb)){?>                        
                        <?php if($row->isSale){?>
                        <img class="sale-ico" src="<?=$this->baseUrl("templates/default/images/sale.gif")?>" width="50" height="50" />
                        <?php }?>
                        <img width="100" height="168" src="<?=$this->baseUrl("images/product/thumb/$row->thumb")?>" alt="<?=$row->name?>" />    
                    <?php }else{?>
                        Đang cập nhật hình.
                    <?php }?>
                    </a>
                    <div class="productNameWrap"><a href="<?=$this->baseUrl("product/$row->alias/$row->id")?>" title="<?=$row->name?>"><?=$row->name?></a></div>
                    <div class="productNamePrice">$<?=number_format($row->price,2,".","")?></div>
                    <ul><li><a class="btn addtocart" href="<?=$this->baseUrl("cart/add/$row->id-$row->alias.html")?>">• Add to Cart</a></li><li><a href="<?=$this->baseUrl("product/$row->alias/$row->id")?>" class="btn detail">• detail</a></li></ul>
                </div>    
                <?php }?>
                <div class="clearb"></div>
                <?php if($stt!=count($arr)){?>                 
                <hr />
                <?php }?>
             </div>       
             <?php $stt++;}?>
              <?php if($this->datas->count()>1){// Nhiều hơn 1 trang thì sử dụng phân trang?>
             <?=$this->paginationControl($this->datas,"Sliding","partial/pagination-control.phtml")?>
             <?php }?>
        </div>
 </div>
 
 <script>
$(function(){
    
    $(".addtocart").click(function(){
        var link = $(this).attr("href");        
        $.get(link, null, function(rdata){
            $(".giohang a").html("<span style='color:#000;'>" + rdata + "</span>" + " item");
            window.location = "<?=$this->baseUrl("cart/")?>";
        },"json");
        
        return false;
    })
    
})
</script>